//
//  NetworkClient+DataSet.swift
//  SitPosition
//
//  Created by apple on 2019/2/3.
//  Copyright © 2019 apple. All rights reserved.
//

import Foundation


/**
 * 用户学习统计接口
 */
extension NetworkApi {
    
    // 根据日期来统计的接口
    public static func statByDate() -> NetworkApi {
        return NetworkApi("/userCenter/userStatistics/search/findByStatisticDate", method: .get)
    }
}

extension NetworkClient {
    
    // 用户-获取某天学习统计数据
    func statByDate(statisticDate: Int64,
                    success: DataParamCallback?,
                    failure: ErrorCallback?) {
        // 指定统计日期
        let params: [String : Any] = [
            "statisticDate": statisticDate
        ]
        let completionHandler = commonDataRequestCompletion(success: success, failure: failure)
        NetworkClient.instance.request(NetworkApi.statByDate(), params: params, headers: nil)
            .responseData(completionHandler: completionHandler)
    }
}
